<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
			src="<c:url value="/static/js/common.js"/>"></script>		
<script type="text/javascript">
	function initList(listDisplayEId) {
		$('#' + listDisplayEId).datagrid(
				{
					nowrap : false,
					striped : true,
					collapsible : true,
					remoteSort : true,
					notSelectByRow : false,
					toolbar : [
							
							 ],
					onLoadError : function() {
						$.messager.alert('错误', '获取数据失败，请与管理员联系！', 'error');
					},
					onClickRow : function(rowIndex) {
						$(".myrad").prop("checked", false);
						$(".myrad").eq(rowIndex).prop("checked", true);
					}
				});

	};
	$(document).ready(function() {
		initList('listDisplay');
	});
	
	
	function  goDetailedContent(val,rowData,rowIndex){
		return '<a href="#" onclick="constructionManager(\'' + rowData.ordId+ '\',\'' + rowData.ordSupId + '\')">'+val+'</a>  '
	}
	
	function constructionManager(id,supId) {
		var new_win = window.open("<c:url value='/jsp/openIndexSun.jsp?url=/unusual/goUnusualDetailedForCust.do'/>"+"?id="+id+"&supId="+supId,"sun","width=1200px,height=600px,status=no,scrollbars=yes");
		new_win.focus();
	}
	//下拉框
	$(function() {        
        // 下拉框选择控件，下拉框的内容是动态查询数据库信息  
        $('#ordState').combobox({   
            data:[{"ordState":"0","ordStateName":"全部"},{"ordState":"1","ordStateName":"待定品级"},{"ordState":"2","ordStateName":"待录实际需求重量"},{"ordState":"3","ordStateName":"待发货"},{"ordState":"4","ordStateName":"待收货"},{"ordState":"5","ordStateName":"收货完毕"}],   
            editable:false, //不可编辑状态  
            cache: false,  
            valueField:'ordState',     
            textField:'ordStateName',  
        });      
    }); 
	function searchInfo(){
		if($('#ordState').combobox('getValue') ==''){
			$('#listDisplay').datagrid('load', {
				ordState : 0,
				ordDate : $('#ordDate').datebox('getValue'),
				ordCustName :$('#ordCustName').val()
			}); 
		}else{
			$('#listDisplay').datagrid('load', {
				ordState : $('#ordState').combobox('getValue'),
				ordDate : $('#ordDate').datebox('getValue'),
                ordCustName :$('#ordCustName').val()
			});  
		}
	}
	
	// 颜色
    function cellStyler(value, row, index) {
        if(row['ordPaymentState']==1){
            return 'color:red;';
        }
    }
</script>
</head>

<body>
	<table>
		<tr>
		    <td>
			<div style="height: auto; width:1180px;background: #fafafa; padding: 5px;" class="easyui-panel" title="查询" iconCls="icon-search" collapsible="true" minimizable="false" maximizable="false" closable="false">
					<form id="searchForm" name="searchForm" method="post"
						action="userlist.txt"
						onsubmit="return searchDGData(this.id,'listDisplay');">
						<div>
		            	<table cellpadding="5">
								<tr>
								    <td>店长名：</td>
                                    <td><input class="easyui-validatebox" id="ordCustName"  name="ordCustName"></input></td>
									<td>订单状态：</td>
									<td><input class="easyui-combobox" id="ordState" editable="false" name="ordState"></input></td>
									<td>订单日期：</td>
									<td><input class="easyui-datebox" editable="true" id="ordDate" name="ordDate"></input></td>
		                    		<td><input type="button" onclick="searchInfo()" value="查询"></td>
		                    	</tr>
		                </table>					 
						</div>
					</form>
				</div>
			</td>
		</tr>
		<tr><td>
	<table id="listDisplay" title="供应商订单列表" singleSelect=true
		iconCls="icon-list" idField="id"
		url="<c:url value="/unusual/findUnusualOrderForCust.do"/>"
		style="width: 800px; width: 1180px;" loadMsg="请稍候......"
		pagination="true" pageSize="10"
		pageList="[10,20,30,40,50,100,150,200]" sortName="roleId"
		rownumbers="true" sortOrder="asc">
		<thead>
				<tr>
				    <th field="id" width="25" align="center"  checkbox="true">
					</th> 
					<th field="oId" width="80"  sortable="true" hidden="true" >订单实体ID
                    </th>
				    <th field="ordId" width="80"  sortable="true" >
						订单ID
					</th>	
 					<th field="ordCustId" width="80" sortable="true" >
						客户ID
					</th>	
					<th field="ordCustName" width="80" sortable="true" >
						客户名
					</th>	
					<th field="ordSupId" width="80" sortable="true" >
						供货商ID
					</th>	
					<th field="ordSupName" width="80" sortable="true" >
						供货商名
					</th>	
					<th field="ordState" width="80" formatter="formatOrdStateSupper" sortable="true" >
						订单状态
					</th>	
					<th field="ordPaymentState" width="80" formatter="formatOrdPaymentState" sortable="true" styler="cellStyler" >结款状态
                    </th> 
					<th field="ordDate" width="80" formatter="formatDGField" sortable="true" >
						订单日期
					</th>
					<th field="content" width="130" formatter="goDetailedContent" sortable="true" >
						查看异常详细内容
					</th>	
						
 				</tr>
		</thead>
	</table>
	</td>
	</tr>
	</table>
</body>
</html>